﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace WordServices.HttpService
{
	public class Md5Encoder
	{
		public static string Encode(string value)
		{
			var result = string.Empty;
			if (string.IsNullOrEmpty(value)) return result;
			using (var md5 = MD5.Create())
			{
				byte[] data = md5.ComputeHash(Encoding.UTF8.GetBytes(value));
				var sBuilder = new StringBuilder();
				foreach (byte t in data)
				{
					sBuilder.Append(t.ToString("x2"));
				}
				return sBuilder.ToString();
			}
		}
	}
}
